{% extends 'iframe/basePlus.html.twig' %}
{% block cardHeader %}
    添加<a href="/Admin/Field/index" class="layui-btn layui-btn-sm" style="float:right;margin-top:6px;">列表</a>
{% endblock %}
{% block cardBody %}
    <style>
        .layui-form-label {
            width: 140px;
        }
        .layui-input-block {
            margin-left: 170px;
        }
    </style>
    <form class="layui-form">
        <dry-common role="input" label="名称" name="dry_name" value="" placeholder="请输入名称"></dry-common>
        <dry-common role="input" label="字段" name="dry_field" value="" placeholder="请输入字段"></dry-common>
        <dry-common role="select" label="字段类型" name="dry_field_type" value="" url="/Api/FieldType/getList"></dry-common>
        <dry-common role="radio" label="是否主键字段" name="dry_is_primary" value="0" url="/Api/Choice/getListByKey?key=yesNo"></dry-common>
        <dry-common role="radio" label="是否更新日期时间字段" name="dry_is_update_date_time" value="0" url="/Api/Choice/getListByKey?key=yesNo"></dry-common>
        <dry-common role="radio" label="是否添加日期时间字段" name="dry_is_add_date_time" value="0" url="/Api/Choice/getListByKey?key=yesNo"></dry-common>
        <dry-common role="input" label="默认值" name="dry_default" value="" placeholder="数据库表字段的默认值"></dry-common>
        <dry-common role="input" label="表单默认值" name="dry_form_default" value="" placeholder="添加数据时默认填充的表单值"></dry-common>
        <dry-common role="radio" label="状态" name="dry_status" value="1" url="/Api/Choice/getListByKey?key=status"></dry-common>
        <dry-common role="input" label="备注" name="dry_note" value="" placeholder="请输入备注"></dry-common>
        <dry-common role="input" label="placeholder" name="dry_placeholder" value="" placeholder="请输入placeholder"></dry-common>
        <dry-common role="input" label="帮助文字" name="dry_help" value="" placeholder="帮助文字"></dry-common>
        <dry-common role="input" label="提示文字" name="dry_tip" value="" placeholder="提示文字"></dry-common>
        <dry-common role="input" label="排序" name="dry_sort" value="0" placeholder="请输入排序"></dry-common>
        <dry-common role="select" label="表单类型" name="dry_form_type" value="" url="/Api/Choice/getListByKey?key=formType"></dry-common>
        <dry-common role="select" label="字段模板" name="dry_field_template" value="{{ rs.dry_field_template }}" url="/Api/Choice/getListByKey?key=fieldTemplate"></dry-common>
        <dry-common role="select" label="字段宽度" name="dry_field_width" value="{{ rs.dry_field_width }}" url="/Api/Choice/getListByKey?key=fieldWidth"></dry-common>
        <dry-common role="radio" label="数据源" name="dry_data_source" value="0" url="/Api/Choice/getListByKey?key=fieldDataSource"></dry-common>
        <dry-common role="select" label="变量" name="dry_variable" value="" url="/Api/Choice/getListByKey?key=variable"></dry-common>
        <dry-common role="select" label="域名" name="dry_domain" value="" url="/Api/Choice/getListByKey?key=domain"></dry-common>
        <dry-common role="select" label="API地址" name="dry_api" value="" url="/Api/Choice/getListByKey?key=api"></dry-common>
        <dry-common role="select" label="模型别名" name="dry_model_alias" value="" url="/Api/Model/getAliasList"></dry-common>
        <dry-common role="input" label="key字段" name="dry_key_field" value="" placeholder="id"></dry-common>
        <dry-common role="input" label="value字段" name="dry_value_field" value="" placeholder="dry_name"></dry-common>
        <dry-common role="input" label="SQL" name="dry_sql" value="" placeholder="select id as k,dry_name as v from @table"></dry-common>
        <dry-common role="input" label="回调函数" name="dry_callback" value="" placeholder=""></dry-common>
        <dry-common role="input" label="数据池名称" name="dry_data_pool_name" value="" placeholder=""></dry-common>
        <dry-common role="submit" submit="确定" reset="重置"></dry-common>
    </form>
    <script>
        layui.use(["dry"], function(dry){
            function getVerify()
            {
                var result = {
                    dry_name:function(value){if(value == ""){return "请输入名称";}}
                };
                return result;
            }

            dry.fieldDataSource();

            dry.submit(getVerify(), "/Admin/Field/index", "/Api/Field/new");
        });
    </script>
{% endblock %}